const __construct__ = {
  set(name: string, data: any) {
    localStorage.setItem(name, JSON.stringify(data))
  },
  get(name: string) {
    const temp = localStorage.getItem(name)
    if (!temp) {
      return null
    } else {
      return JSON.parse(temp)
    }
  },
  remove(name: string) {
    localStorage.removeItem(name)
  }
}

export default {
  set: (name: string, data: any) => __construct__.set(name, data),
  get: (name: string) => __construct__.get(name),
  remove: (name: string) => __construct__.remove(name)
}
